/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package databaseupgrade;

import TimeRecording.Upgrade.DatabaseType;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBElement;

/**
 *
 * @author dpatchett
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        new Main().doIt();
    }

    private void doIt() {

        try {
            URL url = this.getClass().getResource("/DaisyChain.xml");

            DatabaseType database = new DatabaseType();

            javax.xml.bind.JAXBContext jaxbCtx =
                    javax.xml.bind.JAXBContext.newInstance(
                            DatabaseType.class.getPackage().getName());

            javax.xml.bind.Unmarshaller unmarshaller = jaxbCtx.createUnmarshaller();
            
            JAXBElement<DatabaseType> root =
                    (JAXBElement<DatabaseType>)unmarshaller.unmarshal(url);

            database = root.getValue();

            new MainFrame(database).setVisible(true);

        } catch (javax.xml.bind.JAXBException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
